<template>
  <div>
    <div class="back-box" @click="backTop">
      <img src="../assets/images/back.png" alt="" />
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    backTop() {
      var clocka = setInterval(function() {
        if (document.documentElement.scrollTop > 0) {
          document.documentElement.scrollTop -= 24;
          // scrollTo(0,0);
        } else {
          clearInterval(clocka);
        }
      }, 10);
    },
  },
};
</script>

<style lang="less" scoped>
.back-box {
  position: fixed;
  right: 5%;
  bottom: 30%;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: @color;
  cursor: pointer;
  img {
    width: 100%;
    height: 100%;
  }
}
</style>
